package org.dtrd.modules.record.service;

import org.dtrd.config.system.Constant;
import org.dtrd.modules.record.entity.bean.HeightBean;
import org.dtrd.modules.record.entity.bean.PeriodBmi;
import org.dtrd.modules.record.entity.bean.WeightBmiChartBean;
import org.dtrd.modules.record.entity.po.DtrdEntRdSigninHeightWeight;

import java.util.Date;
import java.util.List;
import java.util.Map;

/**
 * @author 萧
 * @date:2021-08-22 3:23 下午
 **/
public interface IHeightWeightRecordService extends IRecordService<DtrdEntRdSigninHeightWeight> {

    Float getPatientBmi(Integer patientId, Date queryDate);

    PeriodBmi getBmiDataForCharts(int patientId, String startDate, String endDate);

    List<HeightBean> getAllHeightWeightByUserAndDate(int patientId, String startDate, String endDate);

    /**
     * 获取数据库周期内的身高体重打卡记录
     * @param patientId
     * @param startDate
     * @param endDate
     * @return
     */
    List<DtrdEntRdSigninHeightWeight> getPeriodHeightWeight(Integer patientId, String startDate, String endDate);

    WeightBmiChartBean getWeightBmiDataForChartsInApp(int patientId, String startDate, String endDate);

    List<HeightBean> getAllHeightWeightByPage(int patientId, int page, int pageSize);

    List<HeightBean> getAllHeightWeightBetweenTimeAndPage(int patientId, String startDate, String endDate, int page, int pageSize);

    Integer getHeightWeightRecordCount(int patientId, String startDate, String endDate);

    DtrdEntRdSigninHeightWeight getHeightWeightRecordLatest(Integer patientId);

    Map getHeightWeightStatistics(int patientId, int type, String startTime, String endTime, int period);

    /**
     * 范围最新的一条身高记录
     */
    Float getHeightRecordLatest(Integer patientId);

    /**
     * 获取一条最新的体重或者BMI数据
     * @param patientId
     * @param heightWeight
     * @return
     */
    Float getFirstHeightWeightRecord(Integer patientId, Constant.HEIGHT_WEIGHT heightWeight);

    /**
     * 平均体重
     * @param patientId
     * @param startOfWeek  开始时间
     * @param endOfWeek  结束时间
     * @return
     */
    Float getAvgWeight(Integer patientId, String startOfWeek, String endOfWeek);

    Integer getAvgBmi(Integer patientId, String startOfWeek, String endOfWeek);

    /**
     * 保存体重信息
     */
    boolean saveWeight(HeightBean heightWeightInfo);
}
